<template>
	<div class="app-logs">
		<!-- 日志 -->
		
		<el-scrollbar>
		  <p
		  	v-for="log in logData"
		  	>
		  	{{log.message}}
		  </p>
		</el-scrollbar>
		
	</div>
</template>

<script>
	import {getDataByUrl} from "@/service/components/common.js";
	
	export default {
		props : [
			"options"
		],
		mounted(){
			if(this.options&&this.options.autoGetData){
				this.initData();
			}
		},
		data(){
			return {
				logData : [],
			}
		},
		methods : {
			initData(_params){
				let params = this.options.params ;  
				if(_params){
					params = {
						...params,
						..._params,
					}
				}
				if(this.options&&this.options.serviceFN){
					this.options.serviceFN(params).then(ret=>{
						let data = [];
						ret.data.forEach(el=>{
							data.push(JSON.parse(el))
						})
						this.logData = data;
					})
				}
			}
		}
	}
	
</script>

<style lang="scss">
@import "../../../styles/variables.scss";

.app-logs {
	background : #000;
	font-size: $fontSmall;
	color:#fff;
	padding:10px;
	
	.el-scrollbar {
		.el-scrollbar__wrap {
			padding-bottom:17px;
			height:100%;
			min-height:200px;
			max-height:500px;
			
		}
	}
}
</style>